
echo "============================================================"
while true; do
    echo "--------------------------------------------------"
    ssh -T git@github.com 2>&1 | grep -F successfully
    if [ $? -eq 0 ]; then
        echo "添加到 GitHub 代码托管平台成功"
        break
    fi
    cat ~/.ssh/id_rsa.pub
    read -p "未添加到 GitHub 代码托管平台! 继续添加? [y/n] " input
    case $input in
        y) continue;;
        n) echo "跳过：添加到 GitHub 代码托管平台"; break;;
        *) echo "输入错误，请重试"; continue;;
    esac
done

echo "============================================================"
while true; do
    echo "--------------------------------------------------"
    ssh -T git@gitee.com 2>&1 | grep -F successfully
    if [ $? -eq 0 ]; then
        echo "添加到 Gitee 代码托管平台成功"
        break
    fi
    cat ~/.ssh/id_rsa.pub
    read -p "未添加到 Gitee 代码托管平台! 继续添加? [y/n] " input
    case $input in
        y) continue;;
        n) echo "跳过：添加到 Gitee 代码托管平台"; break;;
        *) echo "输入错误，请重试"; continue;;
    esac
done